package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemLog;
import cn.wolfcode.crm.mapper.SystemLogMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ISystemLogService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class SystemLogServiceImpl implements ISystemLogService{
    @Autowired
    private SystemLogMapper systemLogMapper;


    public int insert(SystemLog record) {
        return systemLogMapper.insert(record);
    }

    public int updateByPrimaryKey(SystemLog record) {
        return systemLogMapper.updateByPrimaryKey(record);
    }

    public List<SystemLog> selectAll() {
        return systemLogMapper.selectAll();
    }

    public int deleteByPrimaryKey(Long id) {
        return systemLogMapper.deleteByPrimaryKey(id);
    }

    @Override
    public PageResult query(QueryObject qo) {
        int total = systemLogMapper.query4Count(qo);
        if(total > 0){
            return new PageResult(total,systemLogMapper.query4List(qo));
        }
        return new PageResult(total, Collections.EMPTY_LIST);
    }
}
